import fetch from '@/config/fetch';

/**
 * 查询活动列表
 * @param {*} pageNumber  当前页
 * @param {*} pageSize    每页数量
 */
export function findActivityList(params, pageNumber, pageSize) {
    return fetch.get('/activity/findActivityList', {
        params: {
            params,
            pageNumber,
            pageSize,
        }
    })
}

/**
 * 根据活动id获取单个活动详情
 * @param {*} id  活动id
 */
export function getActivityById(id, isScan) {
    return fetch.get('/activity/getActivityById', {
        params: {
            id, isScan
        }
    })
}

/**
 * 根据活动id查询活动资料管理列表
 * @param {*} activityId   活动id
 */
export function findActivityFileByAcId(activityId) {
    return fetch.get('/activity/findActivityFileByAcId', {
        params: {
            activityId,
        }
    })
}

//**********************************活动邀请函*************************************//
/**
 * 根据id查询单个活动邀请函
 * @param {*} id 
 */
export function getInvitationById(id) {
    return fetch.get('activity/getInvitationById', {
        params: {
            id,
        }
    })
}
/**
 * 保存用户待查问卷反馈
 */
export function saveInvivationReceipt(eid, invitationId, activityId, invitationReceipt) {
    return fetch.get('/activity/saveInvivationReceipt', {
        params: {
            eid,
            invitationId,
            activityId,
            invitationReceipt
        }
    })
}

/**
 * 根据邀请函id和用户id查询邀请函回执是否同意或拒绝过
 * @param {用户openId} openid 
 * @param {邀请函id} invitationId  
 */
export function getReceiptByInvIdAndUserId(openid, invitationId, wxid, activityId) {
    return fetch.get('/activity/getReceiptByInvIdAndUserId', {
        params: {
            openid,
            invitationId,
            wxid,
            activityId
        }
    })
}

//---------------------- 活动行程 ----------------------------
/**
 * 活动行程列表
 * napolenion
 */
export function findTripList(packetId) {
    return fetch.get('/activity/findTripList', {
        params: {
            packetId,
        }
    })
}

//---------------------活动报名表---------------------------
/**
 * 活动报名列表
 * napolenion
 */
export function findApplicationPageByParams(pageNumber, pageSize, activity_id) {
    return fetch.get('/activity/findApplicationPageByParams', {
        params: {
            pageNumber,
            pageSize,
            activity_id,
        }
    })
}
/**
 * 新增报名表，record:浮动信息，consForm:固定信息（替代，同行）
 * napolenion
 */
export function saveApplicationReceipt(applicationId, record, consForm, gatherId, content) {
    return fetch.post('/activity/saveApplicationReceipt', {
        applicationId: applicationId,
        record: record,
        consForm: consForm,
        gatherId: gatherId,
        content: content,
    })
}
/**
 * 查询单个报名表
 * napolenion
 */
export function getApplicationById(aid) {
    return fetch.get('/activity/getApplicationById', {
        params: {
            aid,
        }
    })
}

//---------------------活动领取资料---------------------------
export function sendContentForEmail(activityId, email) {
    return fetch.get('/activity/sendContentForEmail', {
        params: {
            activityId, email
        }
    })
}

/**
 * 获取用户信息
 */
export function getUserEmail() {
    return fetch.get('/activity/getUserEmail', {
        params: {
        }
    })
}


